package com.example.model;

/**
 * This class will hold information about a date. It will be used for filtering
 * items.
 * 
 * @author 3Factorial
 */
public class Date {

	private int day;
	private int month;
	private int year;

	/**
	 * Creates a date with the given day, month, and year. Verification is
	 * expected outside the class.
	 * 
	 * @param day
	 *            The day
	 * @param month
	 *            The month
	 * @param year
	 *            The year
	 */
	public Date(int day, int month, int year) {
		this.day = day;
		this.month = month;
		this.year = year;
	}

	/**
	 * Checks whether a date is before or the same as a given date.
	 * 
	 * @param date
	 *            Date to check against.
	 */
	public boolean isBefore(Date date) {
		boolean toReturn = false;
		if (year <= date.getYear())
			if (month <= date.getMonth())
				if (day <= date.getDay())
					toReturn = true;
		return toReturn;
	}

	/**
	 * @return The day
	 */
	public int getDay() {
		return day;
	}

	/**
	 * @return The month
	 */
	public int getMonth() {
		return month;
	}

	/**
	 * @return The year
	 */
	public int getYear() {
		return year;
	}
}
